Add effective fleet and silo role to /v1/me
response
#8515
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a weird idea I had a few months ago. I decided to polish it up because we might actually need it now that we have some silo admin-specific operations like #8479 or #8214.
Right now, when the web console wants to know whether a user is a fleet viewer in order to decide whether to show them the fleet-level side of the UI, we try to hit a fleet-viewer only GET endpoint and see if it 200s or not (see console source for that). That is silly but has worked fine for a long time. However, other roles there is no obvious way to do that, plus it gets extra silly if you're hitting 5 different endpoints to figure something out that the API could just tell you.
So here, I add some plumbing that lets us add
to the
/v1/me
response, which heretofore only includes user ID, user display name, silo ID, and silo name. The plumbing is definitely hacked in, especially the role ordering, but based on my tests, it does seem to work.